package com.flying.flyingchessgame.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

/**
 * 日志配置类
 * <p>
 * 配置应用程序的日志记录行为，包括请求日志、SQL日志等。
 * </p>
 * 
 * @author flying-chess
 * @version 1.0
 */
@Configuration
public class LoggingConfig {

    /**
     * 创建请求日志过滤器Bean
     * <p>
     * 配置HTTP请求日志记录，包括请求参数、请求头等信息。
     * </p>
     *
     * @return 请求日志过滤器
     */
    @Bean
    public CommonsRequestLoggingFilter requestLoggingFilter() {
        CommonsRequestLoggingFilter loggingFilter = new CommonsRequestLoggingFilter();
        loggingFilter.setIncludeClientInfo(true);
        loggingFilter.setIncludeQueryString(true);
        loggingFilter.setIncludePayload(true);
        loggingFilter.setIncludeHeaders(false);
        loggingFilter.setMaxPayloadLength(10000);
        return loggingFilter;
    }
} 